#pragma once
#include<iostream>
#include"HashTable.h"
namespace bit
{

	

	template<class K,class V>
	class unordered_map
	{
	public:
		class KOFMap
		{
		public:
			const K& operator()(const std::pair<K,V>& value)const
			{
				return value.first;
			}
		};
	public:
		typedef typename std::pair<const K, V> T;
		typedef typename HashTable<K, T, KOFMap> Table;
		typedef typename bit::HashTable<K,T,KOFMap>::iterator iterator;
		typedef typename bit::HashTable<K,T,KOFMap>::iterator const_iterator;

		std::pair<iterator, bool>insert(const std::pair<K,V>& value)
		{
			return  _table.insert(value);
		}
		const_iterator find(const T& value)const
		{
			return _table.find(value);
		}

		bool delet(const K& key)
		{

			return _table.delet(key);
		}

		iterator begin()
		{
			return _table.begin();
		}
		const_iterator begin()const
		{
			return _table.begin();
		}
		iterator end()
		{
			return _table.end();
		}
		const_iterator end()const
		{

			return _table.end();
		}

		V& operator[](const K& key)
		{
			std::pair<iterator,bool> ret= _table.insert(std::pair<K,V>(key,V()));
			return ret.first->second;

		}


	public:
		Table _table;
	};

}
